// about vuex模块
const state = {
  num: 0,
};

// 一般不会使用getters
const getters = {};

const actions = {
  increment({ commit }, num) {
    console.log("about increment");
    setTimeout(() => {
      commit("INCREMENT", num);
    }, 1000);
  },
};

const mutations = {
  INCREMENT(state, num) {
    state.num += num;
  },
  DECREMENT(state, num) {
    state.num -= num;
  },
};

export default {
  state,
  getters,
  actions,
  mutations,
};
